<template>
    <div class="error">
        404!您访问的页面不存在或已被删除
        <span>{{ time }}后返回首页</span>
    </div>
</template>

<script>
export default {
    data() {
        return {
            time: 10,
            timer: null,
        };
    },
    mounted() {
        this.timer = setTimeout(() => {
            this.$router.push('/');
        }, 1000 * 10);

        this.updateTime();
    },
    methods: {
        updateTime() {
            if (this.time > 0) {
                this.time--;
                setTimeout(() => {
                    this.updateTime();
                }, 1000);
            }
        },
    },
    beforeDestroy() {
        clearTimeout(this.timer);
    },
};
</script>


<style></style>